import random;

#1. 登录功能，用户需要输入用户名和密码，登录失败，则一直登录，直到成功为止
while True:

    username = input("请输入用户名:");

    userpwd = input("请输入密码:");

    if username == "admin" and userpwd == "123456":

        print("恭喜你，登录成功!");
        break;

    else:

        print("登录失败，请重新登录!");

#2. 判断用户是否首次登录
login_first = input("是否首次登录(y/n):");

#定义一个变量用来进行用户工资的存储
money = 0;

if login_first == "y":

    money = int(input("请输入你的工资:"));

else:

    money = random.randint(50000,100000);

print("你当前余额是:",money,"元")

#3. 购物
goods_no = "";

while True:

    if goods_no == "q":

        break;

    else:

        shopping_or_find = input("你是要查询消费记录还是购买商品（0/1）:");

        if shopping_or_find == "q":

            print("不买东西，看看就行");
            break;

        elif shopping_or_find != "0" and shopping_or_find != "1":

            print("你进来不查询，不消费，输入的功能有误，重新输入")

        else:

            print("欢迎进入武器购买大平台!");

            if shopping_or_find == "0":

                print("忙活了半天，进来就为了看一下谢菲记录，赶快出去消费吧!");

            else:
                #定义一个列表用于进行用户购买商品的存储(购物车)
                goods_car = [];
                while True:

                    print("1.飞机(5000元)，2.坦克(8000元)，3.装甲车(8500元)，4.手枪(3000元)，5.望远镜(500元)，6.航空母舰(50000元)，7.军舰(15000元)");

                    goods_no = input("请输入你要购买的商品编号:");

                    if goods_no == "q":

                        print("购物结束啦，不买了。")
                        print("你本次购买的商品是:",goods_car,"你的余额是:",money);
                        break;

                    elif goods_no not in ["1","2","3","4","5","6","7"]:

                        print("你输入的商品编号不存在，请重新输入!");

                    else:

                        if goods_no == "1" and money >= 5000:

                            goods_car.append("飞机");
                            money = money - 5000;

                        elif goods_no == "2" and money >= 8000:

                            goods_car.append("坦克");
                            money = money - 8000;

                        elif goods_no == "3" and money >= 8500:

                            goods_car.append("装甲车");
                            money = money - 8500;

                        elif goods_no == "4" and money >= 3000:

                            goods_car.append("手枪");
                            money = money - 3000;

                        elif goods_no == "5" and money >= 500:

                            goods_car.append("望远镜");
                            money = money - 500;

                        elif goods_no == "6" and money >= 50000:

                            goods_car.append("航空母舰");
                            money = money - 50000;

                        elif goods_no == "7" and money >= 15000:

                            goods_car.append("军舰");
                            money = money - 15000;

                        else:

                            print("你的余额不足，请重新选择商品!");

